//
//  LoginViewController.m
//  Bettle
//
//  Created by Apple on 2017/1/4.
//  Copyright © 2017年 panhongliu. All rights reserved.
//
#import "AppDelegate.h"
#import "UIView+BlockGesture.h"
#import "Networking.h"
#import "LoginViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"登陆"];
    AppDelegate *delegate = [AppDelegate shareInstance];

    [delegate goinloginviewcontroller];

    
    [self.loginBtn addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
        AppDelegate *delegate = [AppDelegate shareInstance];
        [NetworkManger getCacheRequestWithUrlString:@"/beetle/inter/customer/login"  parameters:@{@"uuid":self.userName.text,@"password":self.PassWord.text} cacheTime:NO succeed:^(id data) {
           
        
            NSLog(@"登陆数据%@",data);
            NSLog(@"123333333********######");
            if ([StringWithFormat(data[@"code"])isEqualToString:@"10000"]) {
                NSLog(@"登陆成功");
                [delegate goinloginviewcontroller];
            }else{
                NSLog(@"登陆失败");
            }
            
        } fail:^(NSError *error) {
           
            
            NSLog(@"登陆错误");
        }];
        
        
    }];

    [NetworkManger clearCaches];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
